

#include "stdafx.h"

#include "../../loader.h"

using namespace dlguif;


class sample_appl
{
public:

	Loader loader;
	void* m_main_form;


	sample_appl() //: loader(L"j:/dlguif/dlguif/delphi_dll_project/dlguif.dll")
	{

		m_main_form = loader.CreateForm("window", "mainform", 
			&Loader::MakeRectangle(10, 10, 800, 600) );

		loader.SetGuiEventCallBack(OnGuiEventCallBack, (void*)this);

		loader.ShowForm(m_main_form);

	}

	~sample_appl()
	{

	}

	void Run()
	{
		while(loader.ProcessMessages())
		{
		 
			Sleep(1);
		}
	}

	static void CALLBACK OnGuiEventCallBack(void* user_context, const callback_info* ci)
	{
		sample_appl* appl = (sample_appl*)user_context;
		appl->OnGuiEvent(ci);
	}

	void CALLBACK OnGuiEvent(const callback_info* ci)
	{
		if(ci->eventType == EVENT_TYPE_FORM_CLOSE)
		{
			loader.PostExit(0);
		}
	}


};





int _tmain(int argc, _TCHAR* argv[])
{
 
	sample_appl appl;
	appl.Run();

	return 0;
}
